home *** CD-ROM | disk | FTP | other *** search
- /* A lexical scanner generated by flex */
-
- #define FLEX_FAST_SKEL
-
- #include <stdlib.h>
- #include <io.h>
-
- #include "fastskel.h"
-
- %% section 1 code and the definition of YY_TRANS_OFFSET_TYPE, if needed,go here
-
- #ifndef FLEX_FULL_TABLE
- /* struct for yy_transition */
- struct yy_trans_info {
- /* v is a verify for a transition. */
- short v;
-
- /*
- * In cases where its sister v *is* a "yes, there is a
- * transition", n is* the offset (in records) to the next
- * state. In most cases where there is no transition, the
- * value of n is irrelevant. If n is the -1th record of a
- * state, though, then n is the action number for that state
- */
- YY_TRANS_OFFSET_TYPE n;
- };
- #endif
-
- %%data tables for DFA go here
-
- /*
- * these declarations have to come after the section 1 code or lint
- * gets confused about whether the variables are used
- */
- FILE * yyin = stdin, *yyout = stdout;
-
- /*
- * these variables are all declared out here so that section 3 code can
- * manipulate them
- */
- static char *yy_c_buf_p; /* points to current character in buffer */
- static char *yy_b_buf_p; /* points to start of current scan */
- static int yy_init = 1; /* whether we need to initialize */
- static int yy_start; /* start state number */
-
- /* true when we've seen an EOF for the current input file */
- static int yy_eof_has_been_seen;
-
- static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
- /*
- * yy_ch_buf has to be 2 characters longer than YY_BUF_SIZE because we need
- * to put in 2 end-of-buffer characters (this is explained where it is done)
- * at the end of yy_ch_buf
- */
- static char yy_ch_buf[YY_BUF_SIZE + 2];
-
- /* yy_hold_char holds the character lost when yytext is formed */
- static char yy_hold_char;
- char *yytext;
- static int yyleng; /* length of yytext */
-
- static YY_CS_TYPE yy_last_accepting_state;
- static char *yy_last_accepting_cpos;
-
- static YY_CS_TYPE yy_get_previous_state();
- static int yy_get_next_buffer();
-
- /*
- * * Flex: fast skeleton function prototypes
- */
- static int
- yy_get_next_buffer(void);
- static YY_CS_TYPE
- yy_get_previous_state();
- static void
- unput(char);
- static int
- input(void);
-
- #define FLEX_USES_BACKTRACKING
-
- #ifdef FLEX_USES_BACKTRACKING
- # ifdef FLEX_FULL_TABLE
- # define YY_BACKTRACKING_ACTION(cur_state,cur_buf_p) \
- if ( l[cur_state] ) \
- { \
- yy_last_accepting_state = cur_state; \
- yy_last_accepting_cpos = cur_buf_p; \
- }
- # else
- # define YY_BACKTRACKING_ACTION(cur_state,cur_buf_p) \
- if ( cur_state[-1].n ) \
- { \
- yy_last_accepting_state = cur_state; \
- yy_last_accepting_cpos = cur_buf_p; \
- }
- # endif
- #else
- # define YY_BACKTRACKING_ACTION(cur_state,cur_buf_p)
- #endif
-
- /*--------------------------------------------------------------------------*/
- /*------------------------- BEGIN LEXICAL ANALYZER -------------------------*/
- /*--------------------------------------------------------------------------*/
-
-
- YY_DECL
- {
- register YY_CS_TYPE yy_current_state;
- register int yy_c;
- register struct yy_trans_info *yy_trans_info;
- register int yy_act;
-
- %%user 's declarations go here
-
- if (yy_init) {
- yy_start = 1; /* first start state */
-
- new_file:
- /*
- * this is where we enter upon encountering and end-of-file
- * and yywrap() indicating that we should continue processing
- */
-
- /*
- * we put in the '\n' and start reading from [1] so that an
- * initial match-at-newline will be true.
- */
-
- yy_ch_buf[0] = '\n';
- yy_n_chars = 1;
-
- /*
- * we always need two end-of-buffer characters. The first
- * causes a transition to the end-of-buffer state. The
- * second causes a jam in that state.
- */
- yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yy_eof_has_been_seen = 0;
-
- YY_FAST_INIT;
- yy_init = 0;
- }
- while (1) { /* loops until end-of-file is reached */
- /* support of yytext and yyleng */
- YY_DO_BEFORE_SCAN;
-
- /*
- * yy_b_buf_p points to the position in yy_ch_buf of the
- * start of the current run.
- */
- yy_b_buf_p = yy_c_buf_p;
-
- YY_FIND_START_STATE(yy_current_state);
-
- YY_FIND_NEXT_MATCH;
-
- YY_DO_BEFORE_ACTION;
-
- /*
- * we need this label to process the very last action (right
- * before the end of the file)
- */
- do_action:
- YY_FIND_ACTION(yy_act);
-
- #ifdef FLEX_DEBUG
- fprintf(stderr, "--accepting rule #%d\n", yy_act);
- #endif
- switch (yy_act) {
-
- %%actions go here
-
- case YY_BACK_TRACK:
- YY_DO_BEFORE_SCAN; /* undo the effects of
- * YY_DO_BEFORE_ACTION */
- yy_c_buf_p = yy_last_accepting_cpos + 1;
- yy_current_state = yy_last_accepting_state;
- YY_DO_BEFORE_ACTION;
- goto do_action;
-
- case YY_NEW_FILE:
- break; /* begin reading from new file */
-
- case YY_DO_DEFAULT:
- /*
- * we have to eat up one character and recompute
- * yytext and yyleng
- */
- YY_DO_BEFORE_SCAN; /* undo the effects of
- * YY_DO_BEFORE_ACTION */
- ++yy_c_buf_p;
- YY_DO_BEFORE_ACTION;
- YY_DEFAULT_ACTION;
- break;
-
- case YY_END_OF_BUFFER:
- YY_DO_BEFORE_SCAN; /* undo the effects of
- * YY_DO_BEFORE_ACTION */
-
- switch (yy_get_next_buffer()) {
- case EOB_ACT_END_OF_FILE:
- {
- if (yywrap()) {
- /*
- * note: because we've taken
- * care in
- * yy_get_next_buffer() to
- * have set up yy_b_buf_p, we
- * can now set up yy_c_buf_p
- * so that if some total
- * hoser (like flex itself)
- * wants to call the scanner
- * after we return the
- * YY_NULL, it'll still work
- * - another YY_NULL will get
- * returned.
- */
- yy_c_buf_p = yy_b_buf_p;
- return (YY_NULL);
- } else
- goto new_file;
- }
- break;
-
- case EOB_ACT_RESTART_SCAN:
- yy_c_buf_p = yy_b_buf_p;
-
- YY_DO_BEFORE_RESTART;
- break;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p = &yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- YY_DO_BEFORE_ACTION;
-
- goto do_action;
- }
- break;
-
- default:
- printf("action # %d\n", yy_act);
- YY_FATAL_ERROR("fatal flex scanner internal error");
- }
- }
- }
-
-
- /*
- * yy_get_next_buffer - try to read in new buffer
- *
- * synopsis int yy_get_next_buffer();
- *
- * returns a code representing an action EOB_ACT_LAST_MATCH -
- * EOB_ACT_RESTART_SCAN - restart the scanner EOB_ACT_END_OF_FILE - end of
- * file
- */
-
- static int
- yy_get_next_buffer()
- {
- if (yy_c_buf_p != &yy_ch_buf[yy_n_chars + 1]) {
- YY_FATAL_ERROR("NULL in input");
- /* NOTREACHED */
- } else { /* try to read more data */
- register char *dest = yy_ch_buf;
- register char *source = yy_b_buf_p - 1; /* copy prev. char, too */
- register int number_to_move, i;
- int ret_val;
-
- /* first move last chars to start of buffer */
- number_to_move = yy_c_buf_p - yy_b_buf_p;
-
- for (i = 0; i < number_to_move; ++i)
- *(dest++) = *(source++);
-
- if (yy_eof_has_been_seen)
- /*
- * don't do the read, it's not guaranteed to return
- * an EOF, just force an EOF
- */
- yy_n_chars = 0;
-
- else
- /* read in more data */
- YY_INPUT((&yy_ch_buf[number_to_move]), yy_n_chars,
- YY_BUF_SIZE - number_to_move - 1);
-
- if (yy_n_chars == 0) {
- if (number_to_move == 1)
- ret_val = EOB_ACT_END_OF_FILE;
- else
- ret_val = EOB_ACT_LAST_MATCH;
-
- yy_eof_has_been_seen = 1;
- } else
- ret_val = EOB_ACT_RESTART_SCAN;
-
- yy_n_chars += number_to_move;
- yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- /*
- * yy_b_buf_p begins at the second character in yy_ch_buf;
- * the first character is the one which preceded it before
- * reading in the latest buffer; it needs to be kept around
- * in case it's a newline, so yy_get_previous_state() will
- * have with '^' rules active
- */
-
- yy_b_buf_p = &yy_ch_buf[1];
-
- return (ret_val);
- }
- }
-
-
- /*
- * yy_get_previous_state - get the state just before the eob char was reached
- *
- * synopsis YY_CS_TYPE yy_get_previous_state();
- */
-
- static YY_CS_TYPE
- yy_get_previous_state()
- {
- register YY_CS_TYPE yy_cur_state;
- register char *yy_temp_char_ptr;
-
- YY_FIND_START_STATE(yy_cur_state);
-
- for (yy_temp_char_ptr = yy_b_buf_p; yy_temp_char_ptr < yy_c_buf_p;)
- YY_GET_NEXT_STATE;
-
- return (yy_cur_state);
- }
-
-
- static void
- unput(c)
- char c;
-
- {
- YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */
-
- if (yy_c_buf_p < yy_ch_buf + 2) { /* need to shift things up to
- * make room */
- register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
- register char *dest = &yy_ch_buf[YY_BUF_SIZE + 2];
- register char *source = &yy_ch_buf[number_to_move];
-
- while (source > yy_ch_buf)
- *--dest = *--source;
-
- yy_c_buf_p += dest - source;
- yy_b_buf_p += dest - source;
-
- if (yy_c_buf_p < yy_ch_buf + 2)
- YY_FATAL_ERROR("flex scanner push-back overflow");
- }
- if (yy_c_buf_p > yy_b_buf_p && yy_c_buf_p[-1] == '\n')
- yy_c_buf_p[-2] = '\n';
-
- *--yy_c_buf_p = c;
-
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- }
-
-
- static int
- input()
- {
- int c;
-
- YY_DO_BEFORE_SCAN;
-
- if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) { /* need more input */
- yy_b_buf_p = yy_c_buf_p;
- ++yy_c_buf_p;
-
- switch (yy_get_next_buffer()) {
- /*
- * this code, unfortunately, is somewhat redundant
- * with that above
- */
- case EOB_ACT_END_OF_FILE:
- {
- if (yywrap()) {
- yy_c_buf_p = yy_b_buf_p;
- return (EOF);
- }
- yy_ch_buf[0] = '\n';
- yy_n_chars = 1;
- yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- yy_eof_has_been_seen = 0;
-
- YY_FAST_INIT;
-
- return (input());
- }
- break;
-
- case EOB_ACT_RESTART_SCAN:
- yy_c_buf_p = yy_b_buf_p;
- break;
-
- case EOB_ACT_LAST_MATCH:
- YY_FATAL_ERROR("unexpected last match in input()");
- }
- }
- c = *yy_c_buf_p++;
-
- YY_DO_BEFORE_RESTART;
-
- return (c);
- }
-
- /*--------------------------------------------------------------------------*/
- /*------------------------- END OF LEXICAL ANALYZER ------------------------*/
- /*--------------------------------------------------------------------------*/